package com.huterox.todoscheduler.core.global;

import java.io.Serializable;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 任务清单需要保存的状态，是正在执行的清单的状态
 **/

public class RunningTodoListStateMap implements Serializable {
    private static volatile RunningTodoListStateMap INSTANCE;
    private Map<String, Object> map;
    private RunningTodoListStateMap() {
        map = new ConcurrentHashMap<>();
    }
    public static RunningTodoListStateMap getInstance() {
        if (INSTANCE == null) {
            synchronized (RunningTodoListStateMap.class) {
                if (INSTANCE == null) {
                    INSTANCE = new RunningTodoListStateMap();
                }
            }
        }
        return INSTANCE;
    }
    public Map<String, Object> getMap() {
        return Collections.unmodifiableMap(map);
    }
}
